# Contributor: David Demelier <markand@malikania.fr>
# Maintainer: David Demelier <markand@malikania.fr>
pkgname=lmms
pkgver=1.2.2
pkgrel=1
pkgdesc="Cross-platform music production software"
url="https://lmms.io/"
arch="all !armhf" # build failure
license="GPL-2.0-only"
makedepends="
	alsa-lib-dev
	cmake
	fftw-dev
	jack-dev
	libsamplerate-dev
	libsndfile-dev
	pulseaudio-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	qt5-qtx11extras-dev
	sdl2-dev
	xcb-util-dev
	xcb-util-keysyms-dev
"
subpackages="$pkgname-dev $pkgname-doc"
source="https://github.com/LMMS/lmms/releases/download/v$pkgver/lmms_$pkgver.tar.xz"
options="!check" # No tests
builddir="$srcdir/$pkgname"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DWANT_QT5=On \
		-DWANT_PULSEAUDIO=On \
		$CMAKE_CROSSOPTS .
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}

sha512sums="df74d9e938f1c3807e9941b11db4ccfe9450e23b723c82774de15b7666ac39f1bfdd8519231e28849f994628190ecc92fa05d55bbc0b50a4421f2d183e729028  lmms_1.2.2.tar.xz"
